package com.h2.ref.server.util.lang;

import java.io.UnsupportedEncodingException;

import org.apache.commons.codec.binary.Base64;

public final class EncodingUtil {
   
   private EncodingUtil() {
      //utility class
   }
   
   public static byte[] getBase64UrlDecoded(String value) {
      byte[] decoded = null;;
      try {
         //replace - and _  to + and /
         value = value.replace('-','+');
         value = value.replace('_','/');
         byte[] bToken = value.getBytes("UTF-8");

         decoded = Base64.decodeBase64(bToken);
      } catch (UnsupportedEncodingException exp) {}
      return decoded;
   }
}
